<?php

/**

 * 购物车模型

 * @author maniac

 */

namespace app\common\model;



class Buycar extends Base

{

    protected $table = "maniac_buycar";
    public $insert = ['add_time'];

    public function goods(){
        return $this->hasOne('app\common\model\Goods','id','goods_id')
            ->field('id,goods_name,cost_price,market_price,sale_price,goods_spec_format,goods_thumb_id');
    }

//    public function fields()
//    {
//        $field = 'id,goods_id,goods_sku_id,goods_sku_name,goods_nums,store_id';
//        return $field;
//    }


    /**

     * 添加时间设置器

     * @param string $value 字段值

     */

    public function setAddTimeAttr($value)

    {
        return time();
    }

    /*
     * 商户信息
     * */
//	public function getStoreAttr($value,$data)
//	{
//		$data = Stores::field('id,name')->where('id',$data['store_id'])->find();
//		return $data;
//	}

}

